Skip to content

Fix empty slot detection never firing - #89

Open
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/empty-slot-detection
Open

Fix empty slot detection never firing#89
damilolaedwards wants to merge 1 commit into
ethpandaops:masterfrom
damilolaedwards:fix/empty-slot-detection

Conversation

@damilolaedwards

Copy link
Copy Markdown

Summary

getBlock returns a nil block with a nil error on a 404, but the only caller detecting empty slots checked the error message for "404" instead. Since the error was already nil by the time it got there, that branch was unreachable, so OnEmptySlot never fired and the beacon_empty_slots counter was permanently zero whenever DetectEmptySlots was enabled.

Fix checks the returned block instead of the error. Also pulled the check into its own method so it can be tested directly.

Test plan

  • Added tests in pkg/beacon/empty_slot_test.go covering a missing block, an existing block, and detection disabled
  • Confirmed the missing-block test fails against the old error-based check and passes against the fix
  • go build ./..., go vet ./..., go test -race ./... all green

getBlock returns a nil block with a nil error on a 404, but the only
caller detecting empty slots checked the error message for "404"
instead. Since the error was already nil by the time it got there,
that branch was unreachable and empty slot events never fired. The
check now looks at the returned block instead of the error. Also
pulled the empty slot check into its own method so it can be tested
directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant